package com.totem.base.enums;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum PaymentStateEnum {
    UNPAID("UNPAID"), // 待支付
    CANCEL("CANCEL"), // 已取消/已失效
    FINISHED("FINISHED"), // 收益中/进行中
    DISABLED("DISABLED"); // 已完成/已关闭

    private final String code;

    PaymentStateEnum(String code){
        this.code = code;
    }

    public static PaymentStateEnum byCode(String code) {
        for (PaymentStateEnum e: PaymentStateEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                return e;
            }
        }
        return null;
    }
}
